function staffinsert() {
    var sName = document.getElementById("sName").value;
    var didnum = document.getElementById("didtype");
    var didindex = didnum.selectedIndex;//序号，取当前选中选项的序号
    var did = didnum.options[didindex].value;//获取其中的didnum值
    var pidnum = document.getElementById("pidtype");
    var pidindex = pidnum.selectedIndex;//序号，取当前选中选项的序号
    var pid = pidnum.options[pidindex].value;//获取其中的didnum值
    var sEmail = document.getElementById("sEmail").value;
    var spassword = document.getElementById("spassword").value;
    var sphone = document.getElementById("sphone").value;
    var ssex;
    var ssexradio = document.getElementsByName("sex");//不能getElementById，ById又只会读数组第一个值
    for(var i = 0;i<ssexradio.length;i++)
    {
        if(ssexradio[i].checked)
            ssex = ssexradio[i].value;
    }
    var sisworking = document.getElementById("sisworkingtype").value;

    //验证表单数据是否符合格式
    if(validateNoNull(sName) == false)
    {
        document.getElementById("sNamespan").innerHTML = "姓名不能为空";
        return;
    }
    else{
        document.getElementById("sNamespan").innerHTML = "";
    }
    if(did == 0)
    {
        document.getElementById("didtypespan").innerHTML = "请选择部门";
        return;
    }
    else{
        document.getElementById("didtypespan").innerHTML = "";
    }
    if(pid == 0)
    {
        document.getElementById("pidtypespan").innerHTML = "请选择职位";
        return;
    }
    else{
        document.getElementById("pidtypespan").innerHTML = "";
    }
    if(validateEmail(sEmail) == false)
    {
        document.getElementById("sEmailspan").innerHTML = "邮箱错误";
        return;
    }
    else{
        document.getElementById("sEmailspan").innerHTML = "";
    }
    if(validateNoNull(spassword) == false)
    {
        document.getElementById("spasswordspan").innerHTML = "密码不能为空";
        return;
    }
    else{
        document.getElementById("spasswordspan").innerHTML = "";
    }
    if(validatemobile(sphone) == false)
    {
        document.getElementById("sphonespan").innerHTML = "请重新输入";
        return;
    }
    else{
        document.getElementById("sphonespan").innerHTML = "";
    }

    var datas = JSON.stringify({"sname":sName,"did":did,"pid":pid,"sEmail":sEmail,"spassword":spassword,"sphone":sphone,"ssex":ssex});
    $.ajax({
        type: 'POST',
        url: "/staff/register.do",
        //同步刷新放回的数据支付串
        async:false,
        data: datas,
        headers : {
            'Content-type' : 'application/json;charset=UTF-8'
        },
        success: function (data)
        {
            alert("录入成功");
            window.location.href= "modelpage.jsp";
            return true;
        }
        ,
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert("出现异常，异常信息：" + textStatus, "error");
        }
    });

}


//--------------------------------------------------------



//通过绑定按钮，实现ajax回传的数据放入表格中
//通过绑定按钮，实现ajax回传的数据放入表格中

function loadViewData() {
    var datas = JSON.stringify({"sid": "0"});
    $.ajax({
        type: 'POST',
        url: "/meetingtype/selectAllMeetingtype.do",
//           方法2 data: "sid=12&password=123",
//            方法1 json
        data: datas,
        headers : {
            'Content-type' : 'application/json;charset=UTF-8'
        },
        success: loadData,
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            alert("出现异常，异常信息：" + textStatus, "error");
        }
    });
}
$("#selectm").bind("click",loadViewData);
function loadData(data)
{
    removetbody("selectmeetingtype");
    var tbody = document.createElement("tbody"); //新建一个tbody类型的Element节点
    for(var row of data) {
        var tr = document.createElement("tr"); //新建一个tr类型的Element节点
        var rows = document.getElementById("selectmeetingtype");
        var col = rows.rows.length;//获取数据的长度
        var td = document.createElement("td"); //新建一个td类型的Element节点
        td.innerHTML = row.mtid; // 链接。。。。
        tr.appendChild(td); //将节点td加入tr中
        var td = document.createElement("td"); //新建一个td类型的Element节点
        td.innerHTML = meetingequipmentarr[row.meid];
        tr.appendChild(td); //将节点td加入tr中
//            var td = document.createElement("td"); //新建一个td类型的Element节点
//            td.innerHTML = row.mtordertime;
//            tr.appendChild(td); //将节点td加入tr中
        var td = document.createElement("td"); //新建一个td类型的Element节点
        td.innerHTML = row.mtother;
        tr.appendChild(td); //将节点td加入tr中
        var td = document.createElement("td"); //新建一个td类型的Element节点
        td.innerHTML = row.mtperson;
        tr.appendChild(td); //将节点td加入tr中
        var td = document.createElement("td"); //新建一个td类型的Element节点
        td.innerHTML = row.mtname;
        tr.appendChild(td); //将节点td加入tr中

        tbody.appendChild(tr); //将节点tr加入tbody中

    }
    var parNode = document.getElementById("selectmeetingtype");
    parNode.appendChild(tbody);
}
loadViewData();